/**
 */
package wcomm_v1.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import wcomm_v1.AssemblyLink;
import wcomm_v1.ComplexComponentDefinition;
import wcomm_v1.Component;
import wcomm_v1.DelegationLink;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Complex Component Definition</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.ComplexComponentDefinitionImpl#getComponents <em>Components</em>}</li>
 *   <li>{@link wcomm_v1.impl.ComplexComponentDefinitionImpl#getAssemblyLinks <em>Assembly Links</em>}</li>
 *   <li>{@link wcomm_v1.impl.ComplexComponentDefinitionImpl#getDelegationLinks <em>Delegation Links</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ComplexComponentDefinitionImpl extends ComponentDefinitionImpl implements ComplexComponentDefinition
{
  /**
   * The cached value of the '{@link #getComponents() <em>Components</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getComponents()
   * @generated
   * @ordered
   */
  protected EList<Component> components;

  /**
   * The cached value of the '{@link #getAssemblyLinks() <em>Assembly Links</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAssemblyLinks()
   * @generated
   * @ordered
   */
  protected EList<AssemblyLink> assemblyLinks;

  /**
   * The cached value of the '{@link #getDelegationLinks() <em>Delegation Links</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDelegationLinks()
   * @generated
   * @ordered
   */
  protected EList<DelegationLink> delegationLinks;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ComplexComponentDefinitionImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.COMPLEX_COMPONENT_DEFINITION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Component> getComponents()
  {
    if (components == null)
    {
      components = new EObjectContainmentEList<Component>(Component.class, this, Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS);
    }
    return components;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<AssemblyLink> getAssemblyLinks()
  {
    if (assemblyLinks == null)
    {
      assemblyLinks = new EObjectContainmentEList<AssemblyLink>(AssemblyLink.class, this, Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS);
    }
    return assemblyLinks;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<DelegationLink> getDelegationLinks()
  {
    if (delegationLinks == null)
    {
      delegationLinks = new EObjectContainmentEList<DelegationLink>(DelegationLink.class, this, Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS);
    }
    return delegationLinks;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS:
        return ((InternalEList<?>)getComponents()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS:
        return ((InternalEList<?>)getAssemblyLinks()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS:
        return ((InternalEList<?>)getDelegationLinks()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS:
        return getComponents();
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS:
        return getAssemblyLinks();
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS:
        return getDelegationLinks();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS:
        getComponents().clear();
        getComponents().addAll((Collection<? extends Component>)newValue);
        return;
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS:
        getAssemblyLinks().clear();
        getAssemblyLinks().addAll((Collection<? extends AssemblyLink>)newValue);
        return;
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS:
        getDelegationLinks().clear();
        getDelegationLinks().addAll((Collection<? extends DelegationLink>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS:
        getComponents().clear();
        return;
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS:
        getAssemblyLinks().clear();
        return;
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS:
        getDelegationLinks().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__COMPONENTS:
        return components != null && !components.isEmpty();
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__ASSEMBLY_LINKS:
        return assemblyLinks != null && !assemblyLinks.isEmpty();
      case Wcomm_v1Package.COMPLEX_COMPONENT_DEFINITION__DELEGATION_LINKS:
        return delegationLinks != null && !delegationLinks.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ComplexComponentDefinitionImpl
